Package gwtappcontainer.client

Source Code of gwtappcontainer.client.ContainerUtil

package gwtappcontainer.client;

import gwtappcontainer.shared.ViewProp;

import java.util.logging.Logger;

import com.google.gwt.dom.client.Document;

public class ContainerUtil {
  public static void setBrowserWindowTitle(String title) {
    if (Document.get() != null) {
      Document.get().setTitle(title);
    }
  }
 
  public static Logger getLogger(String name) {
    Logger logger = Logger.getLogger(name);
    logger.setLevel(Constants.clientLogLevel);
   
    return logger;
  }
 
  public static ViewProp getViewDesc(String appViewParams) {
   
    ViewProp viewDesc = new ViewProp(); //initialize to default members
   
    if (appViewParams.equals("")) {
      viewDesc.app = "home";
      viewDesc.view = "main";
      return viewDesc;
    }
   
    String[] split = appViewParams.split("/");
    viewDesc.app = split[0];
   
    if (split.length > 1) {
      String viewParams = split[1];
     
      split = viewParams.split("\\?"); // ? is a reserver regex character, so
                       // needs to be escaped
      viewDesc.view = split[0];
         
      if (split.length > 1) {
        String paramString = split[1];       
        String[] keyValueArray = paramString.split("&");
       
        for (String keyValue : keyValueArray) {
          split = keyValue.split("=");
         
          String key = split[0];
          String value = "";       
          if (split.length > 1) value = split[1];
         
          viewDesc.params.put(key, value);
        }
      }
    }
             
    return viewDesc;
  }
}
TOP

Related Classes of gwtappcontainer.client.ContainerUtil

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.